import router from "./router"
// 路由拦截
router.beforeEach((to, from, next) => {
    if (to.matched.some(record => record.meta.requireAuth)) {
        const token = localStorage.getItem("token")
        if (token) {
            if (!to.path === '/login') {
                next();
            }
        } else {
            next({
                path: '/login'
            })
        }
    } else {
        next();
    }
})